package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 交易类型（1-分销佣金入账，2-佣金提现，3-佣金提现失败退回）
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum CommissionBillTradeTypeEnum {

    ORDER_COMMISSION(1, "分销佣金入账"),
    WITHDRAWAL_COMMISSION(2, "佣金提现"),
    WITHDRAWAL_COMMISSION_FAIL(3, "佣金提现失败退回"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    CommissionBillTradeTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static CommissionBillTradeTypeEnum typeOf(Integer value) {
        CommissionBillTradeTypeEnum[] values = CommissionBillTradeTypeEnum.values();
        for (CommissionBillTradeTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static CommissionBillTradeTypeEnum typeOf(String name) {
        CommissionBillTradeTypeEnum[] values = CommissionBillTradeTypeEnum.values();
        for (CommissionBillTradeTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
